package com.zhp.farmerclient.controller;

import com.zhp.farmerclient.common.Result;
import com.zhp.farmerclient.service.SearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/index")
@CrossOrigin//解决前端后端跨域问题
public class SearchController {

    @Autowired
    private SearchService searchService;

    //搜索
    @GetMapping("/search")
    public Result search(@RequestParam Integer page,
                         @RequestParam Integer pageSize,
                         @RequestParam(defaultValue = "") String keyword,
                         @RequestParam(defaultValue = "") String type) {
        return  searchService.search(page,pageSize,keyword, type);
    }
}
